package com.huobao.yunying.adapters;

import com.huobao.yunying.entity.Fenlei;
import com.huobao.zhangying.R;

import android.content.Context;
import android.graphics.Color;
import android.widget.TextView;
import joanzapata.android.BaseAdapterHelper;
import joanzapata.android.QuickAdapter;

public class Adapter_Types extends QuickAdapter<Fenlei> {

	private int selectPosition = 1;

	public Adapter_Types(Context context) {
		super(context, R.layout.item_fenlei_textview);
		// TODO Auto-generated constructor stub
	}

	public void setSelectPos(int pos) {
		this.selectPosition = pos;
		notifyDataSetChanged();
	}

	@Override
	protected void convert(BaseAdapterHelper arg0, Fenlei arg1) {
		TextView textView = arg0.getView(R.id.tv_text);
		textView.setText(arg1.getValue());
		if (selectPosition == arg0.getPosition()) {
			textView.setBackgroundColor(Color.WHITE);
			textView.setTextColor(Color.parseColor("#D0041F"));
		} else {
			textView.setBackgroundColor(Color.parseColor("#efeeee"));
			textView.setTextColor(Color.parseColor("#303030"));
		}
	}
}
